/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wggcth.persistencia.vo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author deusemar
 */
@Entity
@Table(name = "variavel", catalog = "wggcth", schema = "")
@NamedQueries({@NamedQuery(name = "Variavel.findAll", query = "SELECT v FROM Variavel v"), @NamedQuery(name = "Variavel.findByIdvariavel", query = "SELECT v FROM Variavel v WHERE v.idvariavel = :idvariavel"), @NamedQuery(name = "Variavel.findByNome", query = "SELECT v FROM Variavel v WHERE v.nome = :nome")})
public class Variavel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDVARIAVEL", nullable = false)
    private Integer idvariavel;
    @Column(name = "NOME", length = 30)
    private String nome;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "variavel")
    private Collection<DadosExperimento> dadosExperimentoCollection;
    @JoinColumn(name = "IDEXPERIMENTO", referencedColumnName = "IDEXPERIMENTO", nullable = false)
    @ManyToOne(optional = false)
    private Experimento idexperimento;

    public Variavel() {
    }

    public Variavel(Integer idvariavel) {
        this.idvariavel = idvariavel;
    }

    public Integer getIdvariavel() {
        return idvariavel;
    }

    public void setIdvariavel(Integer idvariavel) {
        this.idvariavel = idvariavel;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Collection<DadosExperimento> getDadosExperimentoCollection() {
        return dadosExperimentoCollection;
    }

    public void setDadosExperimentoCollection(Collection<DadosExperimento> dadosExperimentoCollection) {
        this.dadosExperimentoCollection = dadosExperimentoCollection;
    }

    public Experimento getIdexperimento() {
        return idexperimento;
    }

    public void setIdexperimento(Experimento idexperimento) {
        this.idexperimento = idexperimento;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvariavel != null ? idvariavel.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Variavel)) {
            return false;
        }
        Variavel other = (Variavel) object;
        if ((this.idvariavel == null && other.idvariavel != null) || (this.idvariavel != null && !this.idvariavel.equals(other.idvariavel))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "wggcth.persistencia.vo.Variavel[idvariavel=" + idvariavel + "]";
    }

}
